package com.summer.data.springboot;

import com.summer.data.spring.SessionTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;

@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(SessionTemplate.class)
public class SessionTemplateConfiguration {

    private static final Logger logger = LoggerFactory.getLogger(SessionTemplateConfiguration.class);

    @Bean
    @Primary
    public SessionTemplate sessionTemplate(JdbcTemplate jdbcTemplate) {
        logger.debug("SessionTemplate 初始化");
        return new SessionTemplate(jdbcTemplate);
    }

}
